<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
</head>
<body>
<br><br>
<form class="layui-form" th:action="@{/tea/item/myitem/choose/updatesubmit}">

    <input type="hidden" name="id" th:value="${exam.getId()}">
    <div class="layui-form-item">
        <label class="layui-form-label">问题题目</label>
        <div class="layui-input-block">
            <input type="text" name="subject" required th:value="${exam.getSubject()}" lay-verify="required" placeholder="请输入题目" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选项A</label>
        <div class="layui-input-block">
            <input type="text" name="answer_a" th:value="${exam.getAnswer_a()}" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
        <!--        <div class="layui-form-mid layui-word-aux">辅助文字</div>-->
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选项B</label>
        <div class="layui-input-block">
            <input type="text" name="answer_b" th:value="${exam.getAnswer_b()}" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
        <!--        <div class="layui-form-mid layui-word-aux">辅助文字</div>-->
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选项C</label>
        <div class="layui-input-block">
            <input type="text" name="answer_c" th:value="${exam.getAnswer_c()}" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
        <!--        <div class="layui-form-mid layui-word-aux">辅助文字</div>-->
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选项D</label>
        <div class="layui-input-block">
            <input type="text" name="answer_d" th:value="${exam.getAnswer_d()}" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
        <!--        <div class="layui-form-mid layui-word-aux">辅助文字</div>-->
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属章节</label>
        <div class="layui-input-block">
            <select name="coursetype_id" lay-verify="required">
                <option value=""></option>
                <option th:each="coursetype:${coursetypes}"  th:value="${coursetype.getId()}" th:text="${coursetype.getCourse_name()}" th:selected="${coursetype.getId()==exam.getCoursetype_id()}"></option>
            </select>
        </div>
    </div>
    <div class="layui-form-item" th:if="${exam.getType_id()==1}">
        <label class="layui-form-label">正确答案</label>
        <div class="layui-input-block">
            <input type="radio" name="answer_true" value="[A]" title="A" th:checked="${exam.getAnswer_true().equals('[A]')}">
            <input type="radio" name="answer_true" value="[B]" title="B" th:checked="${exam.getAnswer_true().equals('[B]')}">
            <input type="radio" name="answer_true" value="[C]" title="C" th:checked="${exam.getAnswer_true().equals('[C]')}">
            <input type="radio" name="answer_true" value="[D]" title="D" th:checked="${exam.getAnswer_true().equals('[D]')}">
        </div>
    </div>
    <div class="layui-form-item" th:if="${exam.getType_id()==2}">
        <label class="layui-form-label">正确答案</label>
        <div class="layui-input-block">
            <input type="checkbox" name="answer_true" value="A" title="A" th:checked="${exam.getAnswer_true().contains('A')}">
            <input type="checkbox" name="answer_true" value="B" title="B" th:checked="${exam.getAnswer_true().contains('B')}">
            <input type="checkbox" name="answer_true" value="C" title="C" th:checked="${exam.getAnswer_true().contains('C')}">
            <input type="checkbox" name="answer_true" value="D" title="D" th:checked="${exam.getAnswer_true().contains('D')}">
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">答案解析</label>
        <div class="layui-input-block">
            <textarea name="description" th:text="${exam.getDescription()}" placeholder="请输入答案解析" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit  type="submit">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

    });
</script>
</html>